package cate.game.role.world;

import cate.common.game.GameCollection;
import cate.game.role.Role;
import cate.game.role.RolePart;
import cate.game.role.world.beta.MyBeta;
import cate.game.role.world.giftcode.MyGiftCode;
import cate.game.role.world.other.MyWorldOther;
import easy.java.dev.note.NoteField;
import org.springframework.data.mongodb.core.mapping.Document;

@Document(collection = GameCollection.NAME_ROLE_WORLD)
public class RoleWorld extends RolePart {

    @NoteField("笔记")
    public String note;

    public MyGiftCode giftCode;

    public MyBeta beta;

    public MyWorldOther other;

    public RoleWorld() {
    }

    public RoleWorld(Role role) {
        super(role);
    }

    @Override
    public void initialize(Role role) {
        super.initialize(role);
        if (giftCode == null) {
            giftCode = new MyGiftCode();
        }
        giftCode.initialize(role);
        if(beta == null) {
            beta = new MyBeta();
        }
        beta.initialize(role);
        if (other == null) {
            other = new MyWorldOther();
        }
    }

    @Override
    public void onEnter() {
        super.onEnter();
        beta.onEnter();
    }
}
